package mysqlInit

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"type:varchar(30)" json:"account"`
	Password string `gorm:"type:varchar(32)" json:"password"`
}

type Shop struct {
	gorm.Model
	ShopName string  `gorm:"type:varchar(30)" json:"shopName"`
	Price    float64 `gorm:"type:decimal(10,2)"json:"price"`
	Image    string  `gorm:"type:varchar(225)"json:"image"`
	Num      int     `gorm:"type:int"json:"num"`
	Status   string  `gorm:"type:varchar(20)"json:"status"`
}

type Order struct {
	gorm.Model
	UserId   int    `gorm:"type:int" json:"userId"`
	OrderSn  string `gorm:"type:varchar(50)" json:"orderSn"`
	Total    string `gorm:"type:decimal(10,2)" json:"total"`
	Status   string `gorm:"type:int" json:"status"`
	OrderPay string `gorm:"type:int " json:"orderPay"`
}

func (s *Shop) ShopAdd(db *gorm.DB) error {
	return db.Create(s).Error
}
